package com.will.repo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.will.common.dto.ProductDto;
import com.will.common.response.AjaxResult;
import com.will.repo.domain.Repo;
import com.will.repo.mapper.RepoMapper;
import com.will.repo.service.IRepoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class RepoServiceImpl extends ServiceImpl<RepoMapper, Repo> implements IRepoService {

    @Autowired
    private RepoMapper repoMapper;

    @Override
    public AjaxResult decreaseRepo(ProductDto productDto) {
        try {
            int num = repoMapper.decreaseRepo(productDto);
            if (num > 0) {
                return AjaxResult.success();
            }
            return AjaxResult.error();
        } catch (Exception e) {
            return AjaxResult.error();
        }
    }
}
